import {Modal} from 'ant-design-vue';

const HDK = {
    /**
     * 信息弹窗
     * @param {'success'| 'info' | 'error' | 'warning'} type
     * @param {string} info
     */
    infoDialog(type, info, okCallback) {
        const dialog = Modal[type] || Modal.info;
        dialog({
            title: '提示',
            content: info,
            centered: true,
            maskClosable: false,
            okText: '知道了',
            cancelText: '关闭',
            onOk() {
                okCallback && okCallback();
            }
        });
    },

    info(msg, onOk) {
        this.infoDialog('info', msg, onOk);
    },

    get page() {
        return {
            showTotal: (total, range) => `共 ${total} 条`,
            showSizeChanger: true,
            total: 0,
            current: 1,
            pageSize: 10
        }
    },
}

export default HDK;